import React, {Component} from 'react';
import {Table,Pagination} from 'element-react'
import './tablebar.css'

export default class TableShow extends Component {
    render() {
        return (
            <div id='tablebar' className='tablebar'>
                <Table
                    style={{width: '100%', borderRadius: '4px', color: '#49d9fe', textAlign: 'center'}}
                    columns={this.props.columns}
                    data={this.props.data}
                    showSummary={true}
                    sumText='总计'
                    align='center'
                    summaryMethod={this.props.setColumns}
                ></Table>
                <Pagination
                    style={this.props.total === 0 ? {display:'none'} : {display:'block'}}
                    layout="total, prev, pager, next, jumper"
                    total={this.props.total}
                    pageSize={this.props.pageSize}
                    currentPage={this.props.pageNum}
                    onSizeChange={(value) => {
                        this.props.setPageSize(value,this.props.pageNum)
                    }}
                    onCurrentChange={(value) => {
                        this.props.setPageNum(this.props.pageSize,value)
                    }}
                />
            </div>
        )
    }
}